package com.yubest.designpattern.behavior.state;

import lombok.Data;

/**
 * QQ
 *
 * @Author: hweiyu
 * @Date: 2022/10/26 18:07
 */
@Data
public class QQ {

    private State state;

    public void operate() {
        if (null != getState()) {
            /**
             * 1:上线; 2:下线; 3:忙碌
             */
            if (getState().getValue() == 1) {
                getState().online();
            } else if (getState().getValue() == 2) {
                getState().offline();
            } else if (getState().getValue() == 3) {
                getState().busy();
            }
        }
    }
}
